<?php

/*
 * This page is for update child profile.
 */
$actor = $_POST['actor'];


include '../../include/config.php';


if ($actor == 'CHILD') {
    mysql_query("update baby_child_profile_detail set `name`='" . $_POST['name'] . "', `sur_name`='" . $_POST['sur_name'] . "', `sex`='" . $_POST['sex'] . "', `date_of_birth` =  '" . $_POST['date_of_birth'] . "', `address`='" . $_POST['address'] . "',`zip_code` ='" . $_POST['zip_code'] . "',`city`='" . $_POST['city'] . "',`district`='" . $_POST['disctrict'] . "',`country`='" . $_POST['country'] . "',`phone`='" . $_POST['phone'] . "', `mobile`='" . $_POST['mobile'] . "',`personal_identification_code`='" . $_POST['personal_identification_code'] . "',`national_health_service_pers_code`='" . $_POST['national_health_service_pers_code'] . "',`PIN_code`='" . $_POST['PIN_code'] . "',`email`='" . $_POST['email'] . "',`height`='" . $_POST['height'] . "',`weight`='" . $_POST['weight'] . "',`group` =  '" . $_POST['group'] . "', `religion`='" . $_POST['religion'] . "',`private_helath_insurance_company`='" . $_POST['private_helath_insurance_company'] . "',`insurance`='" . $_POST['insurance'] . "',`phone_insurance`='" . $_POST['phone_insurance'] . "',`name_personal_attending_doctor`='" . $_POST['name_personal_attending_doctor'] . "',`private_practice_phone_nr`='" . $_POST['private_practice_phone_nr'] . "',`mobile_phone_nr`='" . $_POST['mobile_phone_nr'] . "',`wtype`='".$_POST['wtype']."' where `bid`=" . $_COOKIE['bid'] . " ") or die(mysql_error());
    header('Location:../view/child');
} elseif ($actor == 'FATHER') {
    mysql_query("update salus_user_profile_detail set `name`='" . $_POST['name'] . "', `sur_name`='" . $_POST['sur_name'] . "', `sex`='" . $_POST['sex'] . "', `date_of_birth` =  '" . $_POST['date_of_birth'] . "', `address`='" . $_POST['address'] . "',`zip_code` ='" . $_POST['zip_code'] . "',`city`='" . $_POST['city'] . "',`district`='" . $_POST['disctrict'] . "',`country`='" . $_POST['country'] . "',`phone`='" . $_POST['phone'] . "', `mobile`='" . $_POST['mobile'] . "',`personal_identification_code`='" . $_POST['personal_identification_code'] . "',`national_health_service_pers_code`='" . $_POST['national_health_service_pers_code'] . "',`PIN_code`='" . $_POST['PIN_code'] . "',`email`='" . $_POST['email'] . "',`height`='" . $_POST['height'] . "',`weight`='" . $_POST['weight'] . "',`group` =  '" . $_POST['group'] . "', `religion`='" . $_POST['religion'] . "',`private_helath_insurance_company`='" . $_POST['private_helath_insurance_company'] . "',`insurance`='" . $_POST['insurance'] . "',`phone_insurance`='" . $_POST['phone_insurance'] . "',`name_personal_attending_doctor`='" . $_POST['name_personal_attending_doctor'] . "',`private_practice_phone_nr`='" . $_POST['private_practice_phone_nr'] . "',`mobile_phone_nr`='" . $_POST['mobile_phone_nr'] . "', marital_status = '" . $_POST['marital_status'] . "',nr_children = '" . $_POST['nr_children'] . "',`wtype`='".$_POST['wtype']."' where `FK_fa_user_id`=" . $_POST['fid'] . " ") or die(mysql_error());
    header('Location:../view/father');
} elseif ($actor == 'MOTHER') {
    $mid = mysql_fetch_array(mysql_query("select mother_id from baby_child_profile_detail where bid='" . $_COOKIE['bid'] . "' "));
    echo $mid[0];
    mysql_query("update salus_user_profile_detail set `name`='" . $_POST['name'] . "', `sur_name`='" . $_POST['sur_name'] . "', `sex`='" . $_POST['sex'] . "', `date_of_birth` =  '" . $_POST['date_of_birth'] . "', `address`='" . $_POST['address'] . "',`zip_code` ='" . $_POST['zip_code'] . "',`city`='" . $_POST['city'] . "',`district`='" . $_POST['disctrict'] . "',`country`='" . $_POST['country'] . "',`phone`='" . $_POST['phone'] . "', `mobile`='" . $_POST['mobile'] . "',`personal_identification_code`='" . $_POST['personal_identification_code'] . "',`national_health_service_pers_code`='" . $_POST['national_health_service_pers_code'] . "',`PIN_code`='" . $_POST['PIN_code'] . "',`email`='" . $_POST['email'] . "',`height`='" . $_POST['height'] . "',`weight`='" . $_POST['weight'] . "',`group` =  '" . $_POST['group'] . "', `religion`='" . $_POST['religion'] . "',`private_helath_insurance_company`='" . $_POST['private_helath_insurance_company'] . "',`insurance`='" . $_POST['insurance'] . "',`phone_insurance`='" . $_POST['phone_insurance'] . "',`name_personal_attending_doctor`='" . $_POST['name_personal_attending_doctor'] . "',`private_practice_phone_nr`='" . $_POST['private_practice_phone_nr'] . "',`mobile_phone_nr`='" . $_POST['mobile_phone_nr'] . "', marital_status = '" . $_POST['marital_status'] . "',nr_children = '" . $_POST['nr_children'] . "' where `FK_fa_user_id`=" . $mid[0] . " ") or die(mysql_error());
    header('Location:../view/mother');
}
?>
